Data Storage method and data storage structure

ABSTRACT

A data storage method and a data storage structure are provided. In one aspect, a method of storing data includes setting a first data node in a first storage area; setting a second data node in a second storage area; wherein said second data node is an element of a plurality of elements forming a first flat table of at least one flat table in the second storage area; and said step of setting a first data node includes storing in the first data node a two-tuple linker which comprises a first identifier indicating said first flat table and a second identifier indicating the row of said element in the first flat table. In another aspect a corresponding data storage structure is further provided. According to the present invention, it is able to achieve easily data chaining via a two-tuple linker in a special-purpose processor that does not support a pointer of memory address, thereby reducing requirements on space needed for data storage and enhancing efficiency of chaining each data segment.

FIELD OF THE INVENTION

The present invention relates to a data storage method and a datastorage structure, and more particularly, to a data storage method and adata storage structure for use in a special-purpose processor that doesnot support a pointer.

BACKGROUND OF THE INVENTION

A special-purpose processor, like a mathematical processor which servesas a coprocessor of a universal processor and performs mathematicaloperations, and a network processor which is used for processing networkservices (switches, routers etc) or the like, is a high-performanceprocessor that is specifically designed for some specific applications.

However, as special applications demand, a special-purpose processor mayhave to trade some of its flexibility for realization of its specificfunctions. In general, a special-purpose processor employs a collectionof high-performance hardware engines, and each of them is crafted tosupport specific functions, such as queue management, table lookup, andaccess to memory or the like. In order to achieve higher performance, aspecial-purpose processor often adopts a memory structure which departsfrom the conventional memory hierarchy (e.g., main memory, cache memoryor the like). In a special-purpose processor, memory are oftenpartitioned into control memory which houses host information for dataprocessing and data memory which houses data accompanying requests forprocessing.

In a special-purpose processor which employs at least a search engine,an index table can be implemented for fast lookup. Therefore, there areat least two types of tables supported in such special-purposeprocessor: index table and flat table. An index table can be implementedas an index tree which is a limited set formed by n (n≧0) nodes andincludes a root node, leaf nodes (end nodes) and non-end nodes. Usually,relevant information is stored in leaf nodes. The path from the rootnode of the index tree to a leaf node is identified by a key in theindex table. A user can access an index table by providing a tree ID anda key and then invoking a table lookup (index tree search) command.Latency of a lookup depends on the length of the key and the structureof the tree.

A flat table can be implemented as a memory array. Each row or column ofa memory array may store a row (element) of a flat table.

In data processing, data chaining allows data to be well-linkedlogically, thereby reducing spatial requirements on storage unit whilekeeping data integrity at the same time. The flexibility of softwaredesign of data processing heavily depends on the single pointer as asingle and simple mechanism of data chaining.

Due to use for special applications, a special-purpose processor oftendoes not support memory access via a pointer (address of a memorylocation) and consequently, loses the capability of data chaining via asingle pointer. The lack of such a single pointer prevents data chainingfrom being implemented easily and results in worse flexibility ofsoftware design.

Because of upper limit on the size of a leaf node, the capacity ofinformation that can be stored in a leaf node is also restricted. As aresult, demands of some complex applications (e.g., tunnelingapplication involved in network communication, or the like) cannot bemet. Therefore, there is a need to expand the information capacity of aleaf node, for example.

However, since a special-purpose processor lacks the capability of datachaining via a single pointer, the efficiency of data chaining is ratherlow, which gives rise to a conflict between large data and smallcapacity of data storage unit.

SUMMARY OF THE INVENTION

It is an object of the present invention to provide a data storagemethod and a data storage structure to enable a special-purposeprocessor to achieve data chaining easily and expand storage capacity ofa data node.

According to an aspect of the present invention, a method of storingdata is provided, the method comprising the steps of:

-   -   setting a first data node in a first storage area;    -   setting a second data node in a second storage area;    -   wherein said second data node is an element of a plurality of        elements forming a first flat table of at least one flat table        in the second storage area;    -   and said step of setting the first data node includes storing in        the first data node a two-tuple linker which comprises a first        identifier indicating said first flat table and a second        identifier indicating the row of said element in the first flat        table.    -   According to another aspect of the present invention, a data        storage structure is also provided, which comprising:    -   a first data node set in a first storage area;    -   a second data node set in a second storage area;    -   wherein said second data node is an element of a plurality of        elements forming a first flat table of the at least one flat        table in the second storage area;    -   and said first data node contains a two-tuple linker which        comprises a first identifier indicating the first flat table and        a second identifier indicating the row of said element in the        first flat table.

According to the present invention, it is able to achieve easily datachaining via a two-tuple linker in a special-purpose processor that doesnot support a pointer of memory address. For instance, in a memoryhierarchy in a form of flat table, each flat table is identified by atable identifier, and each row of a flat table is identified by acorresponding element identifier. By means of the flat table identifierand the element identifier in a two-tuple linker, the present inventionrealizes chaining with data nodes or storage units that serve aselements of a flat table, thereby reducing spatial requirements on aspecial storage unit or a data node for storing data and enhancingefficiency of chaining each data.

Other features and advantages of the present invention will becomeapparent from the following description, taken in conjunction with theaccompanying drawings wherein the same reference numerals denoteidentical or like parts.

BRIEF DESCRIPTION ON THE DRAWINGS

The novel features believed as characteristics of the invention are setforth in the appended claims. The invention itself, however, as well asa preferred mode of use, further objectives and advantages thereof, willbest be understood by reference to the following detailed description ofan illustratively embodiment when read in conjunction with theaccompanying drawings, wherein

FIG. 1 is a flow chart of a data storage method according to anembodiment of the present invention;

FIG. 2 is a schematic view of a data storage structure according toanother embodiment of the present invention; and

FIG. 3 is a schematic view of a data storage structure according to afurther embodiment of the present invention.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

The preferred embodiments and the advantages of the present inventionwill be better understood with reference to the accompanying drawings.

As various specific details are provided for a comprehensiveunderstanding of the present invention in the following discussion,those skilled in the art should understand that the present inventioncan be carried out without these specific details. In the description ofthe embodiments, well-known components are illustrated in a form ofschematic or block diagrams so as to prevent unnecessary details fromobscuring the present invention.

To solve the problem that a special-purpose processor fails to performdata chaining via a pointer, according to an embodiment of the presentinvention, a scheme of performing data chaining via a two-tuple linkeris proposed, so that the function of data chaining can be easilyimplemented in a special-purpose processor that does not support apointer.

In detail, data to be stored in a data storage structure is segmentedinto multiple data segments, each data segment is stored to a storageunit that can accommodate this data segment, and accordingly, atwo-tuple linker is also stored to this storage unit. With thistwo-tuple linker, the data segment stored in this storage unit ischained with a next data segment stored in another storage unit.

FIG. 1 shows a data storage method according to an embodiment of thepresent invention. As shown in FIG. 1, the data storage method includesthe steps of: segmenting data to be stored to a data storage structureinto a plurality of data segments (step S110); storing said plurality ofdata segments to a plurality of storage units, respectively (step S120);and storing a two-tuple linker to each of said plurality of storageunits except for the one used for storing the last data segment (stepS130), so that a data segment stored in a storage unit is chained with anext data segment stored in another storage unit via this two-tuplelinker. In other words, the stored two-tuple linker points to a nextdata segment.

Of course, a storage unit may also store only a two-tuple linker, whichis caused to point to a first data segment, and do not store any datasegment.

By means of chaining of each data segment, storage units used forstoring all data segments are logically chained. In this chain ofstorage units, each storage unit stores a data segment and a two-tuplelinker except that the last storage unit stores only the last datasegment. Of course, the first storage unit may store only the firsttwo-tuple linker, while the first data segment is stored in the secondstorage unit. In this case, the first storage unit stores only the firsttwo-tuple linker, the last storage unit stores only the last datasegment, and other storage units store both a data segment and atwo-tuple linker.

Under normal situations, the first storage unit of a chain of storageunit may house information in a leaf node (logically primary leaf) of anindex tree, and other storage units of this chain of storage unit storea two-tuple linker and/or data segment in a form of elements of a flattable, as extension of this leaf node.

In this case, the used two-tuple linker may include a flat tableidentifier TID and an element identifier EID, wherein the flat tableidentifier TID points to the table number of the flat table where thenext data segment is located, and the element identifier EID points tothe element number or row number of the flat table where this datasegment is located. Elements in the flat table may be accessed via theflat table identifier TID and element identifier EID. Both flat tableidentifier TID and element identifier EID are software-defined elementsin one embodiment.

When a task is initiated, a processing engine or processor utilizes theinput data for a tree lookup. After a match occurs, i.e., a proper logicprimary leaf is found, when needed, the processor can utilizes atwo-tuple linker {TID, EID} to read information in the logicallyextended leaf.

FIG. 2 illustrates a data storage structure according to a preferredembodiment of the present invention. As shown in FIG. 2, the datastorage structure according to the present invention comprises a firststorage unit 210 and a second storage unit 220. The first storage unit210 comprises a first data segment 212 and a first two-tuple linker 214,where the first two-tuple linker 214 points to a second data segment 222included in the second storage unit 220. For instance, the second datasegment 222 included in the second storage unit 220 may be accessed byproviding the first two-tuple linker 214.

The first storage unit 210 may be not spatially adjacent to the secondstorage unit 220, so long as there exists such corresponding logicrelation that the second data segment 222 inside the second storage unit220 can be accessed by means of the first two-tuple linker 214 in thefirst storage unit 210.

Of course, those skilled in the art should understand that the firststorage unit 210 may include the first two-tuple linker 214 only, i.e.,the first storage unit 210 may not include the first data segment 212.

The above-described data storage structure may further include a thirdstorage unit (not shown) for storing a third data segment. In this case,the second storage unit 220 needs to include a second two-tuple linkerwhich points to the third data segment.

Those skilled in the art can conceive that the data storage structuremay also include a fourth storage unit, a fifth storage unit, etc., eachof which includes a corresponding data segment. The number of storageunits included is not supposed to limit the present invention. Ofcourse, those skilled in the art should understand that each storageunit may store only one two-tuple linker or store a plurality oftwo-tuple linkers according to needs.

FIG. 3 illustrates a data storage structure according to anotherembodiment of the present invention. As shown in FIG. 3, the datastorage structure comprises multiple cascades of storage unit (only twocascades are shown in this figure). The first cascade of storage unit310 includes one storage unit, the second cascade of storage unit 320includes N storage units, and the third cascade of storage unit includesM×N storage units (not shown).

The first cascade of storage unit 310 includes N two-tuple linkers,which point to N flat table elements stored respectively in the Nstorage units of the second cascade of storage unit 320, respectively.Each of storage units of the second cascade of storage unit 320 includesM two-tuple linkers, which point to M flat table elements storedrespectively in the M storage units of the third cascade of storageunit, respectively.

Each cascade of storage unit may also store corresponding data segmentsaccording to needs. This cascading mechanism is of great use inapplications such as load balance (both N and M are positive integersgreater than 1). Clearly, the new data chaining mechanism (data storagemethod) can provide the chaining capability which a special-purposeprocessor had traded for its performance gain. And this new datachaining eliminates the physical limitation on memory (i.e., physicallimitation of the leaf capacity).

Those skilled in the art can conceive that the data structure applicableis not limited to the tree structure so long as multiple data segmentscan be chained together via two-tuple linkers. Data structures do notconstitute any limitation to the present invention.

Those skilled in the art should understand the aforesaid data segmentsmay include various types of data, such as integer, float and string orthe like.

The data storage structure and data storage method according to thepreferred embodiments of the present invention may be applied to theabove-described special-purpose processor or other processors. The typeof applicable processors does not constitute any limitation to thepresent invention.

It should be noted that all the functions described here may beimplemented by hardware or software or a combination thereof, unlessotherwise specified.

A basic idea of the present invention is to provide, via a two-tuplelinker, data chaining in a special-purpose processor that does notsupport a memory address pointer, so as to break through the limitationon space needed for data storage and enhance the efficiency of chainingeach data segment.

The description of the present invention has been presented for purposesof illustration and description, and is not intended to be exhaustive orlimit the invention to the form as disclosed. Various modification andvariations will be apparent to those of ordinary skill in the art. Theembodiment was chosen and described in order to best explain theprinciples of the invention, the practical application, and to enableothers of ordinary skill in the art to understand that all modificationsand alterations made without departing from the spirit of the presentinvention fall into the protection scope of the present invention asdefined in the appended claims.

1. A method of storing data, comprising the steps of: setting a firstdata node in a first storage area; setting a second data node in asecond storage area; wherein said second data node is an element of aplurality of elements forming a first flat table of at least one flattable in the second storage area; and said step of setting the firstdata node includes storing in the first node a two-tuple linker whichcomprises a first identifier indicating said first flat table and asecond identifier indicating a row of said element in the first flattable.
 2. The method as claimed in claim 1, further comprising: storingin the first data node a piece of data together with said two-tuplelinker.
 3. The method as claimed in claim 1 or 2, wherein said step ofsetting the second data node further includes: storing in the seconddata node at least one two-tuple linker each comprising a firstidentifier indicating a second flat table of at least one flat table anda second identifier indicating an element of a plurality of elements inthe second flat table.
 4. The method as claimed in claim 1, wherein saidstep of setting the second data node further includes: storing in thesecond data node a piece of data.
 5. The method as claimed in claim 3,wherein the second flat table and the first flat table are the same flattable.
 6. The method as claimed in claim 3, wherein the second flattable and the first flat table are different flat tables.
 7. A datastorage structure, comprising: a first data node set in a first storagearea; a second data node set in a second storage area; wherein saidsecond data node is an element of a plurality of elements forming afirst flat table of at least one flat table in the second storage area;and said first data node includes a two-tuple linker which comprises afirst identifier indicating said first flat table and a secondidentifier indicating a row of said element in the first flat table. 8.The data storage structure as claimed in claim 7, wherein a piece ofdata is stored in the first data node.
 9. The data storage structure asclaimed in claim 7, wherein said second data node includes one or moretwo-tuple linkers, each of which includes a first identifier indicatinga second flat table of the at least one flat table and a secondidentifier indicating an element of a plurality of elements in thesecond flat table.
 10. The data storage structure as claimed in any oneof claims 7, wherein said second data node includes a piece of data. 11.The data storage structure as claimed in claim 9, wherein the secondflat table and the first flat table are the same flat table.
 12. Thedata storage structure as claimed in claim 9, wherein the second flattable and the first flat table are different flat tables.
 13. The datastorage structure as claimed in claim 7, wherein the first data node isa leaf node of tree-type storage architecture.